package com.example.onlinejudge.controller;

import com.example.onlinejudge.service.CommandUtilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.io.IOException;

@Controller
public class CommandUtilController {
    @Autowired
    private CommandUtilService commandUtilService;

    public int run(String cmd, String stdoutFile, String stderrFile) throws IOException, InterruptedException {
        if(stderrFile==null&&stdoutFile==null){
            return 1;
        }else{
            return commandUtilService.run(cmd,stdoutFile,stderrFile);
        }
    }
}
